home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Software Vault: The Gold Collection
/
Software Vault - The Gold Collection (American Databankers) (1993).ISO
/
cdr47
/
wasm223.zip
/
STRING
< prev
next >
Wrap
Text File
|
1993-05-04
|
1KB
|
38 lines
//
// Session String Routines, By Eric Tauck
//
String_End JUMP
// ---------------------------------------
// Call a routine for each string element.
// ---------------------------------------
: ForString // (string routine - )
SWAP // put string address on top
: ForString1
DUP @ $FF AND // get string element and mask character
?DUP ForString2 ?JUMP // jump if not end of string
DROP DROP ; // fix stack and exit
: ForString2
2 PICK CALL BREAK 1+ // call routine, break, and increment string
ForString1 JUMP // break and loop back
// ---------------------------------------------------
// Call a conditional routine for each string element.
// ---------------------------------------------------
: ForString? // (string routine - 0 | -1)
SWAP // put string address on top
: ForString?1
DUP @ $FF AND // get string element and mask character
?DUP ForString?2 ?JUMP // skip exit if not end of string
DROP DROP TRUE ; // fix stack and exit
: ForString?2
2 PICK CALL BREAK // call routine and break
SWAP 1+ SWAP // increment string
ForString?1 ?JUMP // loop back if success
DROP DROP FALSE ; // fix stack and exit
: String_End